const KoaRouter = require("@koa/router");
const commentRouter = new KoaRouter({prefix: "/comment"});

const {verifyAuthorization} = require("../middleware/login.middleware");
const commentController = require("../controller/comment.controller");
const verifyResourceExists = require("../middleware/exists.middleware");

// 增：发表评论
commentRouter.post("/add", verifyAuthorization, commentController.add);
// 增：回复评论
commentRouter.post("/reply", verifyAuthorization, commentController.reply);
// 查：某条动态评论列表
commentRouter.post("/list", verifyAuthorization, commentController.list);
// 删：删除某条评论
commentRouter.delete("/:commentId", verifyResourceExists, verifyAuthorization, commentController.remove);

module.exports = commentRouter;
